﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MedicalAdviser.DataTypes.DomainObjects;
using MedicalAdviser.DataTypes.WsTypes;
using MedicalAdviser.HtppProxy.HttpOperations;
namespace InfarmedAdviser.ConsumeRest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

           
            var uri = "http://localhost/MedicalAdviser.RestService/AdviserOperations.svc/Account";

            MedicalAdviser.HtppProxy.HttpOperations.Operations cena = new Operations();


            // Create a new product
            var gizmo = new Auth()
                {
                    AccessToken = "123424",
                    App = "infarmed12Ads",
                    Operation = AuthenticationAction.Login,
                    Type = OauthProvider.Google
                };

            var a = MedicalAdviser.HtppProxy.HttpOperations.Operations.Post<MedicalAdviser.DataTypes.ServiceOut<List<CdoDrug>>, Auth>(
                "http://localhost/MedicalAdviser.RestService/AdviserOperations.svc/Search", "Quick", gizmo);

        
     }


        private MedicalAdviser.HtppProxy.HttpOperations.ProxyDrugAdviser _proxyDrug;

        private void button2_Click(object sender, EventArgs e)
        {

            _proxyDrug = new ProxyDrugAdviser();
            _proxyDrug.SetBaseUrl("http://localhost/MedicalAdviser.RestService/AdviserOperations.svc");

            var list = _proxyDrug.QuickSearch(new SearchDrug() {GenericSearch = "Paracetamol"});


            dataGridView1.DataSource = list.Value;

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
